package com.jackiechancinema.ssm.controller;

import com.jackiechancinema.ssm.bo.OfficialBo;
import com.jackiechancinema.ssm.entity.Official;
import com.jackiechancinema.ssm.service.Inte.OfficialService;
import com.jackiechancinema.ssm.vo.PageVo;
import com.jackiechancinema.ssm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/offic")
public class OfficialController {
    @Autowired
    private OfficialService officialService;

//    //查询所有
//    @RequestMapping("/find")
//    public PageVo<Official> find(int page, int limit){
//        PageInfo<Official> all = officialService.findAll(page,limit);
//        PageVo<Official> pageVo = new PageVo<Official>(SystemContant.PAGE_R,"OK",all.getTotal(),all.getList());
//        return pageVo;
//    }
    @RequestMapping("/find")
    public PageVo<Official> find(OfficialBo bo){

        return officialService.findAllV2(bo);
    }

    //添加
    @RequestMapping("/add")
    public R OffAdd(Official official){

        return officialService.OffAdd(official);
    }

    //修改
    @RequestMapping("/update")
    public R OffUpdate(Official official){
        return officialService.OffUpdate(official);
    }

    //根据ID删除
    @RequestMapping("/del")
    public R OffDel(int id){
        return officialService.OffDel(id);
    }
}
